public class Solution2000 {
    public String reversePrefix(String word, char ch) {
        int t=word.indexOf(ch);
        return t==-1?word:new StringBuilder(word.substring(0,t+1)).reverse().toString().concat(word.substring(t+1));
    }

    public static void main(String[] args) {
        System.out.println(new Solution2000().reversePrefix("abcdefd",'d'));
    }
}
